#ifndef GUI_VIEW_H_H_H_H_H
#define GUI_VIEW_H_H_H_H_H
#include "base/BaseClass.h"
namespace App
{
	class Document;
}
namespace Gui
{
	class Gui_Document;

class BaseView : public Base::BaseClass
{
	TYPESYSTEM_HEADER();
public:
	BaseView(Gui::Gui_Document* pcDocument=0);
	virtual~BaseView(void);

	 Gui::Gui_Document* getGuiDocument() const {return _pcDocument;}

	 App::Document* getAppDocument() const;

    void setDocument(Gui::Gui_Document* pcDocument);

	virtual void onUpdate(void){}

	/// get called when the document is relabeled (change of its user name)
	virtual void onRelabel(Gui::Gui_Document *){}

	/// get called when the document is renamed (change of its internal name)
	virtual void onRename(Gui::Gui_Document *){}

	/// returns the name of the view (important for messages)
	virtual const char *getName(void) const
	{ return "Base view"; }

	/// Message handler
	virtual bool onMsg(const char* pMsg, const char** ppReturn){return true;};

	/// Message handler test
	virtual bool onHasMsg(const char* pMsg) const{return true;};

	/// overwrite when checking on close state
	virtual bool canClose(void){return true;}

  virtual void deleteSelf();

  void onClose(void);

protected:

	Gui::Gui_Document*  _pcDocument;

	bool bIsDetached;

	bool bIsPassive;

};
}

#endif